<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0">
    <title>本商户计次卡</title>
    <link rel="stylesheet" href="__STATIC_URL__/static/mobile/css/weui.css" />
    <link rel="stylesheet" href="__STATIC_URL__/static/mobile/mycord/css/cord1.css" />
    <link rel="stylesheet" href="__STATIC_URL__/static/css/dropload.css" />
    <!--<link rel="stylesheet" href="__STATIC_URL__/static/mobile/css/setmecard.css" />-->
    <style>
        .cardAddress, .overdue {
            color: #696969;

        }
        .cardName {
            font-size: 13px;
            font-weight: 400;
            color: #4a4a4a;
            line-height: 29px;
        }
        .red .rows {
            margin-left: 16%;

        }
        .icon {
            width: 15px;
            height: 15px;

            position: absolute;
            top: 13px;
            left: 3rem;
        }
        .default {
            text-align: center;
            flex: 1;
            margin: 0 0 0 0px;
            position: relative;
        }

        .ictext {
            color: #484848;
            font-size: 0.8rem;
            height: 45px;
            line-height: 45px;
            width: 100%;
            overflow: hidden;
            padding-left:14px;
        }
        .paycard {
            position: relative;
        }
        .aft {

            top: 37%;
            right: 12px;
        }
        .overdue {
            margin: 0px;

        }
        .shopName {
            margin-top: 13px;
        }
    </style>
</head>
<body>

<div class="container" id="container">



    <div class="body">
        <div class="nav bc_white">
            <div class="default red" id="selected" data-id="selected">

                <img src="__STATIC_URL__/static/mobile/mycord/img/jicilist.png"class="icon"style=""/>
                <div class="ictext">本商户计次卡</div>
                <p class="rows"></p>
            </div>
            <div class=" default " id="selected1" data-id="selected1">
                <a href="{:url('cardjc/cardjcmy',['card_id'=>$info['card_id']])}">
                    <img src="__STATIC_URL__/static/mobile/mycord/img/myjici.png"class="icon"/>
                    <div class="ictext">我的计次卡</div>
                    <p class="rows"></p>
                </a>
            </div>

        </div>
        <div class="content" id="id" data-id="{$info['card_id']}" >

            <div class="selected1" style="display:block" id="kind">

                <div id="kin" data-page=""></div>

                <div class="clear"></div>

            </div>



            <div class="selected2" id="zanwu" style="display:none">
                <div class="zanwu">
                    <img src="__STATIC_URL__/static/mobile/mycord/img/wu.png"class="wu"/>
                    <div>暂无优惠券，赶快来领取哦~~</div>
                </div>
            </div>
        </div>


    </div>
    <div class='cardWrap' id="Refresh">
        <img src="__STATIC_URL__/static/mobile/mycord/img/shuaxin.png"class="Refresh"/>
    </div>
</div>
</body>
<script src="__STATIC_URL__/static/jquery/3.2.1/jquery.min.js"></script>
<script src="__STATIC_URL__/static/js/dropload1.js"></script>
<script src="https://res.wx.qq.com/open/js/jweixin-1.2.0.js"></script>
<script type="text/javascript">
    wx.config({$share.wxjssdk});
    wx.ready(function () {
        wx.checkJsApi({
            jsApiList: [
                'onMenuShareTimeline','onMenuShareAppMessage','onMenuShareQQ',
                'onMenuShareWeibo','onMenuShareQZone'
            ],
        });
        var sharedata = {
            title:"{$info.brand_name}-次卡",
            desc:"{$info.brand_name}-次卡",
            link: "https://os.wunengkeji.com/mobile.php/cardjc/cardjclist/card_id/{$info.card_id}",
            imgUrl: "{$info.logo_url}",
        };
        wx.onMenuShareAppMessage(sharedata);
        wx.onMenuShareTimeline(sharedata);
        wx.onMenuShareQQ(sharedata);
        wx.onMenuShareWeibo(sharedata);
        wx.onMenuShareQZone(sharedata);

    })
</script>
<script>
    $(document).ready(function(){
        //加载分页
        load();
    });
    function load() {
        var num = 5;
        var page = 1;
        var card_id=$("#id").attr("data-id");
        var dropload = $('#kind').dropload({
            scrollArea:window,
            loadDownFn:function(me){

                $.ajax({
                    url: "{:url('cardjc/cardjclist')}",
                    type: 'post',
                    dataType: 'json',
                    data:{
                        card_id:card_id,
                        page:page
                    },
                    success: function (res) {
                        console.log(11,res);
                        var pagenum=parseInt(res.page_num);
                        var pages=parseInt(res.page);
                        var result = '';
                        var data=res.data;
                        if(data==""&& pagenum ==0){
                            $("#zanwu").attr("style","display:block")
                        }
                        var html="";
                        var html3 ="";
                        var length=data.length;
                        if(res.code==9002){
                            me.lock();
                            // 无数据
                            me.noData();
                            me.resetload();
                            if(page ==1){
                                $(".dropload-down").css("display","none");//没有更多数据的文字
                            }
                        }else{
                            $("#zanwu").attr("style","display:none")

                            $(".dropload-load").show();
                            page++;
                            for(var i=0;i<length;i++){
                                var id=data[i].id;
                                var card_id="{$info['card_id']}";
                                var url="/mobile.php?s=/cardjc/cardjcinfo/card_id/"+card_id+"/id/"+id+".html"
                                result += '<a href="'+url+'" class="clickself weui-media-box_appmsg"  data-id="'+data[i].card_id+'" >\n' +
                                    '                    <div class="cardList">\n' +
                                    '                        <div class="cardLi">\n' +

                                    '                            <div class="cardleft">\n' +
                                    '                                <img src="'+data[i].logo_url+'" mode="aspectFill" class="shopLogo"/>\n' +
                                    '                            </div>\n' +
                                    '                            <div class="cardRight flex">\n' +
                                    '                                <div class="cardR-top">\n' +
                                    '                                    <div class="cardR-top-left">\n' +
                                    '                                        <div class="cardName">'+data[i].brand_name+'</div>\n' +

                                    '                                        <div class="shopName">'+data[i].title+'</div>\n' +

                                    '                                    </div>\n' +
                                    '                                    <div class="cardR-top-right">\n' +
                                    '                                            <div class="cardAddress already" style="padding-right:10px;    margin-top:7px;"><span class="paycard">立即购买 <span class="aft"></span></span></div>\n' +
                                    '                                        <div class="cardAddress" style="margin-top:2%;margin-right:20px;">'+data[i].price+'元*'+data[i].pay_num+'次</div>\n' +
                                    '                                        <div class="overdue">有效时间：购买后'+data[i].term_of+'天以内。</div>\n' +

                                    '                                    </div>\n' +
                                    '                                </div>\n' +
                                    '                                <div class="cardR-bottom">\n' +
                                    '                                    <div class="cardR-bottom-left">\n' +
                                    // '                                        <div class="cardAddress already" style="padding-right:20px;">详情 <span class="aft"></span></div>\n' +
                                    '                                    </div>\n' +
                                    '\n' +
                                    '                                </div>\n' +
                                    '                            </div>\n' +
                                    '                        </div>\n' +
                                    '                    </div>\n' +
                                    '                </a>';
                                if(length < 5 &&  i ==(length-1) && pages == pagenum  ){
                                    // 锁定//表示一页未满已经没有数据
                                    me.lock();
                                    // 无数据
                                    me.noData();
                                    break;
                                }
                            }
                            $("#kin").append(result)

                            me.resetload();
                        };
                    },
                    error: function (xhr, type) {
                        // 即使加载出错，也得重置
                        me.resetload();
                        // 无数据
                        me.noData();
                    }
                });
            }
        });
    }

</script>
<script>

    $("#Refresh").click(function(){
        window.location.reload();
    })
</script>
<script type="text/javascript">
    $(function () {

        $(".clickself").click(function () {

        })
    });
</script>
</html>
